import PropTypes from 'prop-types'
import React from 'react'

/**
 * 头像组件
 * @param {*} props 
 * @returns 
 */
function Avatar(props) {
  return (
    <img className="Avatar"
         src={props.author.avatarUrl}
         alt={props.author.name}
    />
  )
}

// 定义组件的props约束
Avatar.propTypes = PropTypes.exact({
  avatarUrl: PropTypes.string.isRequired,
  name: PropTypes.string.isRequired
})

export default Avatar
